package com.example.service.impl;

import com.example.mapper.tMesProQualityMapp;
import com.example.pojo.tMesProQualityPojo;
import com.example.service.tMesProQualityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class tMesProQualityImpl implements tMesProQualityService {
    @Autowired
    private tMesProQualityMapp tMesProQualityMapp;
    @Autowired
    private com.example.mapper.tMesProQualityIndexMapp tMesProQualityIndexMapp;

    //查询数据表中有多少条数据
    public Integer queryAllCount(){
        Integer queryAllCount = tMesProQualityMapp.queryAllCount();
        return queryAllCount;
    }

    //查询200万数据，并返回
    public List<tMesProQualityPojo> queryPart(int part){
        List<tMesProQualityPojo> partList = tMesProQualityMapp.queryPart(part);
        return partList;
    }

    //新建一个表，用于数据库分表
    public void newTable(String tableName){
        tMesProQualityMapp.newTable(tableName);
    }

    //将查询到的数据放入新建的分表中
    public void insertCurrentData(List<tMesProQualityPojo> pojoList,String tableName){
        tMesProQualityMapp.insertCurrentData(pojoList,tableName);
    }

    //查询到的数据放入分表中后，将这些数据从旧的表中删除
    public void deleteCurrentData(List<tMesProQualityPojo> pojoList){
        tMesProQualityMapp.deleteCurrentData(pojoList);
    }

}
